package com.my.yc.d0316;

import com.google.gson.Gson;
import com.my.yc.bean.Result;
import com.my.yc.d0316.biz.BookBiz;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "RemoveBookServlet", value = "/RemoveBookServlet.s")
public class RemoveBookServlet extends HttpServlet {
    private BookBiz biz = new BookBiz();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        String id = request.getParameter("id");
        String flag = request.getParameter("flag");
        if ("逻辑删除".equals(flag)){
            biz.remove1(id);
        }else {
            biz.remove(id);
        }
        String json = new Gson().toJson(new Result(1, "删除成功", null));
        response.getWriter().append(json);

    }
}
